import React from 'react';
import { withRouter } from 'react-router-dom';


class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = { 

    };

  }

  
  componentDidMount = () => {
    if(!localStorage.getItem('token')){
      return this.props.history.push('/login')
    }

    let href = window.location.href.split('#')[1]
    if(href == '/'){
      window.location.hash = '#/admin/swiper/swiperList'
    }
  }


  render() {
    return (
      <div>
        { this.props.children }
      </div>
    );
  }
}

export default withRouter(App);